<#include "../head_top.ftl">
        <title>
            Http request online.
        </title>
        <meta name="description" content="Tool for send http requests online. It can do HTTP post request and  HTTP get request">
        <meta name="keywords" content="Http request, HTTP post request, HTTP get request">
<#include "../head_down.ftl">
    
    <body>
		<#include "/template/common/navigator.ftl">
        <div class="container">
            <div class="row">
                <div class="span10">
                    <div id="listing-post-container">
						<h1>Send HTTP Post and Get Request</h1>
						<p></p>
						<p></p>
						<p></p>		
						<p>This tool is used to do HTTP post request, and HTTP get request. It can be used to simulate the crawler, and can also be used to check whether the site is available.</p>
						URL:
						<form method="post" action="http_request" id="form1">
							<table>
								<tr>
									<td>
										<nobr>
										<input type="text" size="76" name="url" id="url" value="${url!''}">
										<select name="requestType" id="requestType" onchange="selectChangeAction()">
											<option value="get"<#if "${requestType!''}"=="get"> selected</#if>>Get</option>
											<option value="post"<#if "${requestType!''}"=="post"> selected</#if>>Post</option>
										</select>
										<input type="button" value="Submit" onclick="doSubmit()"/>
										</nobr>
									</td>
								</tr>								
								<tr id="postTr"<#if "${requestType!''}"!="post"> style="display:none"</#if>>
									<td>
										Post Content:
										<textarea cols="105" rows="5" name="content" id="content">${content!''}</textarea>
									</td>
								</tr>
							</table>
						</form>
						<p/>
						Result:
						<textarea cols="105" rows="15" name="contentResult" readonly="readonly">${contentResult!''}</textarea>
                    </div>
                </div>
                <!--/span10 -->
                <#include "/template/tool/tool_right.ftl">
                <!--/.span4 -->
            </div>
            <!-- /.row -->
        </div>
        <!-- /container -->
		<#include "/template/common/tail.ftl">
    </body>
    <!-- end of body -->
	<script>
		String.prototype.trim=function()
		{
			 return this.replace(/^\s+/g,"").replace(/\s+$/g,"");
		}
		function selectChangeAction(action){
			if(document.getElementById("requestType").value=="post"){
				document.getElementById("postTr").style.display="";
			}else{
				document.getElementById("postTr").style.display="none";
			}
		}
		function doSubmit(action){
			if(document.getElementById("url").value.trim()==""){
				alert("URL is needed.");
				return;
			}
			if(document.getElementById("requestType").value=="post"){
				if(document.getElementById("content").value.trim()==""){
					alert("Post method need post content.");
				}else{
					document.getElementById("form1").submit();
				}
			}else{
				document.getElementById("form1").submit();
			}			
		}
	</script>
</html>